<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:osms="http://java.sun.com/jsf/composite/osms"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
<ui:composition template="../templates/main.xhtml">
	<ui:define name="content">
		<osms:category name="Search Category"
			category="#{searchCategoryForm.search}" disabled="#{false}">

			<f:facet name="commands">
				<h:commandButton action="#{searchCategoryForm.searchCategories}"
					class="btn btn-large" value="Submit"></h:commandButton>
			</f:facet>

		</osms:category>

		<h:form>

			<h:dataTable value="#{searchCategoryForm.result}" var="cat"
				rendered="#{searchCategoryForm.result != null and searchCategoryForm.result.size() > 0}"
				class="table table-striped table-bordered">

				<h:column>
					<f:facet name="header">Nome</f:facet>
					#{cat.name}
					</h:column>
				<h:column>
					#{cat.description}
					<f:facet name="header">Description</f:facet>
				</h:column>
				<h:column>

					<f:facet name="header">options</f:facet>
					<h:commandLink action="#{deleteCategoryForm.initialize(cat)}"
						value="">
						<i class="icon-trash" />
					</h:commandLink>

					<h:commandLink action="#{editCategoryForm.initialize(cat)}"
						value="">
						<i class="icon-pencil" />
					</h:commandLink>
				</h:column>
			</h:dataTable>


			<div class="pagination pagination-centered">
				<ul>
					
					<li ><h:commandLink
									action="#{searchCategoryForm.goToFirstPage()}" value="First">
									<f:ajax render="@form" />
								</h:commandLink></li>
				
					<li ><h:commandLink
									action="#{searchCategoryForm.goToPreviousPage()}" value="Previous">
									<f:ajax render="@form" />
								</h:commandLink></li>
				
					<ui:repeat var="page" value="#{searchCategoryForm.pages}">

						<ui:fragment rendered="#{page.equals(searchCategoryForm.page)}">
							<li class="active"><h:commandLink
									action="#{searchCategoryForm.goToPage(page)}" value="#{page}">
									<f:ajax render="@form" />
								</h:commandLink></li>
						</ui:fragment>
						<ui:fragment rendered="#{!page.equals(searchCategoryForm.page)}">
							<li><h:commandLink
									action="#{searchCategoryForm.goToPage(page)}" value="#{page}">
									<f:ajax render="@form" />
								</h:commandLink></li>
						</ui:fragment>

					</ui:repeat>
					
					<li ><h:commandLink
									action="#{searchCategoryForm.goToNextPage()}" value="Next">
									<f:ajax render="@form" />
								</h:commandLink></li>
				
					<li ><h:commandLink
									action="#{searchCategoryForm.goToLastPage()}" value="Last">
									<f:ajax render="@form" />
								</h:commandLink></li>


				</ul>
			</div>
		</h:form>

	</ui:define>
</ui:composition>
</html>